#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'in.vcf'
exit 2
}

while getopts  ":p:f:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

. $var

extra_info.sh -p$out_prefix $1

sed 1d $out_prefix.fields.txt|af_anno.pl |cut -f1|sed 1i\
'##INFO=<ID=af,Number=1,Type=Float,Description="Allele frequency">' > $out_prefix.af.txt

sed 1d $out_prefix.fields.txt|af_anno.pl |cut -f2|sed 1i\
'##INFO=<ID=depth,Number=1,Type=Integer,Description="Alt allele depth">' > $out_prefix.depth.txt

anno_info_vcf.pl $1 $out_prefix.af.txt |anno_info_vcf.pl - $out_prefix.depth.txt > $out_prefix.af.vcf


. $cmd_done